package com.colourclash.fruitopia
{
	import com.colourclash.fruitopia.controllers.FruitopiaGameController;
	import com.colourclash.fruitopia.models.FruitopiaGameModel;
	import com.colourclash.fruitopia.utils.Global;
	import com.colourclash.fruitopia.views.FruitopiaGameView;
	import flash.display.Sprite;
	import flash.events.Event;
	
	/**
	 * ...
	 * @author Patrick Hammond
	 */
	public class Main extends Sprite 
	{
		[SWF(width="525",height="700",frameRate="60",backgroundColor="0")]
		public function Main():void 
		{
			if (stage)
				init();			
			else 
				addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event = null):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);

			Global.getInstance().stage = stage;
			
			addChild(new FruitopiaGameView(new FruitopiaGameController(new FruitopiaGameModel())));
		}
		
	}
	
}